Adding real versions to the artifact during build in the workflows #215
Adding real versions to the artifact during build in the workflows #215shawn-hurley wants to merge 2 commits intokonveyor:mainfrom
Conversation
Audit all test documentation against actual code and fix numerous stale references accumulated as tests were added without doc updates. Key corrections: - Unit test count: 48 -> 76 (add 5 undocumented test classes) - Integration sub-test count: 43 -> 47 (account for table-driven tests) - Query count: 40+ -> 47 (precise count from code) - PackageDeclarationSearch queries: 2 -> 8 - test-project file count: 6-8 -> 19 (full listing) - JDT.LS version: fix stale 1.35.0/1.38.0 refs to 1.51.0 - Fix useUIHarness: true -> false (match actual pom.xml) - Fix nonexistent doc path: integration/README.md -> docs/integration-tests.md - Fix go.mod dependency version: v0.4.0-alpha.1 -> v0.8.0 Clarify two-Dockerfile setup: - CI uses default Dockerfile (self-contained, builds JAR from source) - Local dev uses Dockerfile.test (requires pre-built JAR, pre-installs Go) - Add mvn install prerequisite to all local container build instructions - Remove unnecessary runtime golang install from Dockerfile.test commands Other fixes: - Replace stale Phase 1/2/3 planning sections with completed milestones - Fix test assertions API (referenced nonexistent test_utils.go) - Replace fake expected output with actual Go test framework format - Clean up stale 1.18.0 comment in target platform file Signed-off-by: Shawn Hurley <shawn@hurley.page>
📝 WalkthroughWalkthroughThis PR advances project versioning to 1.1.0-SNAPSHOT, adds automated version computation and a post-release bump workflow, parameterizes Docker image builds with a BUNDLE_VERSION build arg, updates Maven/OSGi module versions, and expands integration test documentation and test-run plumbing. Changes
Sequence Diagram(s)sequenceDiagram
participant GH as "GitHub Actions"
participant DV as "determine-version job"
participant IB as "image-build job"
participant BA as "build_image_analyzer job"
participant Analyzer as "External Analyzer (repo-dispatch receiver)"
GH->>DV: trigger (push/tag)
DV-->>GH: outputs bundle_version, is_release
GH->>IB: start (depends on DV) with BUNDLE_VERSION
IB-->>GH: image built (artifact with BUNDLE_VERSION)
GH->>BA: start (waits for DV + IB)
BA->>Analyzer: repository_dispatch {ref, ref_name, bundle_version}
Analyzer-->>BA: acknowledged
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
java-analyzer-bundle.test/META-INF/MANIFEST.MF (1)
5-6: Consider aligningFragment-Hostversion constraint with the new bundle line.After bumping
Bundle-Versionto1.1.0.qualifier, keepingFragment-Host: ...;bundle-version="1.0.0"may unintentionally allow attachment to older host lines than intended. If this fragment is only validated for the 1.1.x line, tighten the host version accordingly.Suggested manifest adjustment
-Fragment-Host: java-analyzer-bundle.core;bundle-version="1.0.0" +Fragment-Host: java-analyzer-bundle.core;bundle-version="1.1.0"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@java-analyzer-bundle.test/META-INF/MANIFEST.MF` around lines 5 - 6, The Fragment-Host version constraint should be tightened to match the new Bundle-Version to prevent attaching to older hosts: update the Manifest's Fragment-Host attribute (the line beginning with "Fragment-Host: java-analyzer-bundle.core;bundle-version="1.0.0"") to the appropriate 1.1.x range (e.g., "1.1.0" or "1.1.0.qualifier" or a range like "[1.1.0,2.0.0)") so it aligns with the updated Bundle-Version ("Bundle-Version: 1.1.0.qualifier"); change only the bundle-version value on the Fragment-Host line to enforce the intended host compatibility..github/workflows/post-release-bump.yaml (2)
79-87: Consider adding error handling for branch conflicts.If the workflow runs twice for the same version (e.g., re-tagging),
git push origin "$BRANCH"could fail if the branch already exists. Consider adding--forceor checking for existing branches/PRs.Proposed fix to handle existing branches
- name: Create branch and commit run: | NEXT="${{ steps.next_version.outputs.next_version }}" BRANCH="chore/bump-version-${NEXT}" + # Delete remote branch if it exists (handles re-runs) + git push origin --delete "$BRANCH" 2>/dev/null || true git checkout -b "$BRANCH" git add -A git commit --signoff \ -m "chore: bump version to ${NEXT} after ${{ github.ref_name }} release" git push origin "$BRANCH"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/post-release-bump.yaml around lines 79 - 87, The branch creation/push step can fail if BRANCH already exists; update the logic around the BRANCH variable and the git push command so the workflow handles existing branches (e.g., check for an existing remote branch named "$BRANCH" before creating or use git push --force-with-lease to update safely), and ensure the git checkout -b "$BRANCH" / git commit sequence is skipped or uses git checkout "$BRANCH" when the branch already exists; locate and modify the block that sets NEXT/BRANCH and runs git checkout -b, git push origin "$BRANCH" to implement the existence check or safe force push.
89-116: Consider adding--fillor duplicate PR detection.If the branch already exists with an open PR (from a previous failed run),
gh pr createwill fail. Consider checking for existing PRs first.Proposed fix to handle existing PRs
- name: Create Pull Request env: GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }} run: | RAW="${{ steps.next_version.outputs.raw_version }}" RELEASE="${{ steps.next_version.outputs.release_version }}" NEXT="${{ steps.next_version.outputs.next_version }}" + BRANCH="chore/bump-version-${NEXT}" + + # Check if PR already exists + EXISTING_PR=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number' || true) + if [ -n "$EXISTING_PR" ]; then + echo "PR #${EXISTING_PR} already exists for branch ${BRANCH}, skipping creation" + exit 0 + fi + gh pr create \ --title "chore: bump version to ${NEXT}" \🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/post-release-bump.yaml around lines 89 - 116, The GH CLI step using gh pr create can fail if a branch or PR already exists; modify the workflow around the gh pr create invocation to detect and handle existing PRs for the target branch (--head "chore/bump-version-${NEXT}"). Update the script to first query existing PRs (e.g., gh pr list or gh api with GH_TOKEN/steps.get_workflow_token.outputs.token) filtering by head branch name ${NEXT}/"chore/bump-version-${NEXT}", and if a matching open PR exists skip creation (or call gh pr edit) — alternatively use gh pr create --fill where appropriate; ensure the logic is applied in the block that references RAW, RELEASE, NEXT and the gh pr create command so duplicate-PR failures are avoided.Makefile (1)
96-102: Consider whetherset-versionshould also be a dependency ofbuild-container.Currently
build-containerpassesBUNDLE_VERSIONto Docker but doesn't depend onset-version. If someone runsmake build-container BUNDLE_VERSION=1.2.0without runningset-versionfirst, the local Maven artifacts might have mismatched versions.However, since
Dockerfilehandles version-setting internally during the build, this may be intentional. If the localDockerfile.testworkflow is expected to use pre-built JARs, consider documenting this distinction.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Makefile` around lines 96 - 102, The build-container target may produce images with mismatched Maven artifacts because it uses BUNDLE_VERSION but does not depend on the set-version target; update the Makefile so the build-container target depends on set-version (add "build-container: set-version" or include set-version in its dependency list) to ensure local artifacts match the passed BUNDLE_VERSION, and if the Dockerfile intentionally sets versions during image build (or Dockerfile.test uses pre-built JARs), add a short comment above the build-container target explaining that behavior instead of changing dependencies.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Dockerfile`:
- Around line 30-31: Replace the hardcoded Tycho version
"org.eclipse.tycho:tycho-versions-plugin:4.0.7" used in the mvn invocation with
the latest "5.0.2" everywhere it's pinned (Dockerfile, Makefile, CI/workflow
files); search for the token "tycho-versions-plugin:4.0.7" and update each
occurrence to "tycho-versions-plugin:5.0.2", and if you intentionally must keep
4.0.7 instead, add a short comment or documentation near the mvn command (and
equivalent places) explaining why the older pin is required.
In `@java-analyzer-bundle.test/docs/integration-tests.md`:
- Line 206: Update the documentation line that currently reads "Requires JDT.LS
1.51.0+ and Go 1.21+ installed locally:" to reflect the actual module
requirement by changing "Go 1.21+" to "Go 1.23.9+" so it matches the go version
declared in java-analyzer-bundle.test/integration/go.mod; ensure the exact text
"Go 1.23.9+" replaces "Go 1.21+" in that sentence.
In `@java-analyzer-bundle.test/README.md`:
- Around line 138-141: The README lists "Eclipse Tycho 3.0.1" but the build uses
<tycho.version>4.0.7</tycho.version>; update the README occurrence of "Eclipse
Tycho 3.0.1" to "Eclipse Tycho 4.0.7" so the documented Tycho version matches
the pom.xml's tycho.version entry and avoids confusion.
---
Nitpick comments:
In @.github/workflows/post-release-bump.yaml:
- Around line 79-87: The branch creation/push step can fail if BRANCH already
exists; update the logic around the BRANCH variable and the git push command so
the workflow handles existing branches (e.g., check for an existing remote
branch named "$BRANCH" before creating or use git push --force-with-lease to
update safely), and ensure the git checkout -b "$BRANCH" / git commit sequence
is skipped or uses git checkout "$BRANCH" when the branch already exists; locate
and modify the block that sets NEXT/BRANCH and runs git checkout -b, git push
origin "$BRANCH" to implement the existence check or safe force push.
- Around line 89-116: The GH CLI step using gh pr create can fail if a branch or
PR already exists; modify the workflow around the gh pr create invocation to
detect and handle existing PRs for the target branch (--head
"chore/bump-version-${NEXT}"). Update the script to first query existing PRs
(e.g., gh pr list or gh api with
GH_TOKEN/steps.get_workflow_token.outputs.token) filtering by head branch name
${NEXT}/"chore/bump-version-${NEXT}", and if a matching open PR exists skip
creation (or call gh pr edit) — alternatively use gh pr create --fill where
appropriate; ensure the logic is applied in the block that references RAW,
RELEASE, NEXT and the gh pr create command so duplicate-PR failures are avoided.
In `@java-analyzer-bundle.test/META-INF/MANIFEST.MF`:
- Around line 5-6: The Fragment-Host version constraint should be tightened to
match the new Bundle-Version to prevent attaching to older hosts: update the
Manifest's Fragment-Host attribute (the line beginning with "Fragment-Host:
java-analyzer-bundle.core;bundle-version="1.0.0"") to the appropriate 1.1.x
range (e.g., "1.1.0" or "1.1.0.qualifier" or a range like "[1.1.0,2.0.0)") so it
aligns with the updated Bundle-Version ("Bundle-Version: 1.1.0.qualifier");
change only the bundle-version value on the Fragment-Host line to enforce the
intended host compatibility.
In `@Makefile`:
- Around line 96-102: The build-container target may produce images with
mismatched Maven artifacts because it uses BUNDLE_VERSION but does not depend on
the set-version target; update the Makefile so the build-container target
depends on set-version (add "build-container: set-version" or include
set-version in its dependency list) to ensure local artifacts match the passed
BUNDLE_VERSION, and if the Dockerfile intentionally sets versions during image
build (or Dockerfile.test uses pre-built JARs), add a short comment above the
build-container target explaining that behavior instead of changing
dependencies.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2bbc4fb2-692e-47f2-b582-62b2a64ad8d6
📒 Files selected for processing (19)
.github/workflows/image-build.yaml.github/workflows/post-release-bump.yamlDockerfileDockerfile.testMakefilejava-analyzer-bundle.core/META-INF/MANIFEST.MFjava-analyzer-bundle.core/pom.xmljava-analyzer-bundle.site/pom.xmljava-analyzer-bundle.test/META-INF/MANIFEST.MFjava-analyzer-bundle.test/README.mdjava-analyzer-bundle.test/docs/README.mdjava-analyzer-bundle.test/docs/integration-tests.mdjava-analyzer-bundle.test/docs/query-reference.mdjava-analyzer-bundle.test/docs/quick-reference.mdjava-analyzer-bundle.test/docs/test-projects.mdjava-analyzer-bundle.test/pom.xmljava-analyzer-bundle.tp/java-analyzer-bundle.targetjava-analyzer-bundle.tp/pom.xmlpom.xml
This should enable Tag v0.9.2 -> 1.0.1 release of the artifact. Because we already have 1.0.0 release downstream, this was the best that I could think of to try and map downstream build to the released build downstream using the actual artifact. Signed-off-by: Shawn Hurley <shawn@hurley.page>
33c589a to
57cfb9a
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (3)
.github/workflows/post-release-bump.yaml (1)
40-52:translate_versionfunction differs fromimage-build.yaml- consider extracting to shared script.This
translate_versionimplementation lacks the pre-release suffix handling (-rc.1,-alpha.2) that exists in.github/workflows/image-build.yaml(lines 36-55). While the workflow correctly skips pre-release tags via theifcondition at line 13, keeping these functions consistent would improve maintainability.Consider extracting the version translation logic to a shared shell script (e.g.,
scripts/translate_version.sh) that both workflows can source.♻️ Proposed fix to add suffix handling for consistency
translate_version() { - local raw="$1" base - IFS='.' read -r major minor patch <<< "$raw" + local raw="$1" base suffix="" + # Separate pre-release suffix (e.g., -rc.1, -alpha.2) + if [[ "$raw" == *-* ]]; then + suffix="-${raw#*-}" + base="${raw%%-*}" + else + base="$raw" + fi + IFS='.' read -r major minor patch <<< "$base" if [[ "$major" -ge 1 ]]; then - echo "${raw}" + echo "${base}${suffix}" elif [[ "$minor" -ge 10 ]]; then - echo "1.$((minor - 9)).${patch}" + echo "1.$((minor - 9)).${patch}${suffix}" elif [[ "$minor" -eq 9 && "$patch" -ge 1 ]]; then - echo "1.0.$((patch - 1))" + echo "1.0.$((patch - 1))${suffix}" else - echo "${raw}" + echo "${base}${suffix}" fi }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/post-release-bump.yaml around lines 40 - 52, The translate_version function in this workflow is inconsistent with the one in image-build.yaml and lacks pre-release suffix handling; extract the logic into a shared shell script (e.g., scripts/translate_version.sh) that implements the same transformation as image-build.yaml including detection and preservation of pre-release suffixes (like -rc.1, -alpha.2) and the numeric translation rules, then replace the inline translate_version definitions in both workflows with sourcing of that script and calling the shared translate_version function to ensure consistent behavior and single-point maintenance.java-analyzer-bundle.test/integration/client/jdtls_client.go (1)
191-194: Consider deriving the plugins path fromjdtlsPathinstead of hardcoding.The path
/jdtls/pluginsis hardcoded here, but theJDTLSClientalready storesjdtlsPath. This could cause issues if the JDT.LS installation is at a different location.♻️ Proposed fix to use dynamic path
InitializationOptions: map[string]any{ - "bundles": findAnalyzerBundles("/jdtls/plugins"), + "bundles": findAnalyzerBundles(filepath.Join(c.jdtlsPath, "plugins")), "workspaceFolders": []string{string(workspaceURI)}, },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@java-analyzer-bundle.test/integration/client/jdtls_client.go` around lines 191 - 194, The bundles path is hardcoded as "/jdtls/plugins" but JDTLSClient already holds the installation path in jdtlsPath; update the call to findAnalyzerBundles inside the InitializationOptions map to derive the plugins directory from the client's jdtlsPath (e.g., use filepath.Join(jdtlsPath, "plugins") or path.Join depending on imports) instead of the literal string, ensuring you reference the JDTLSClient receiver/field (jdtlsPath) and keep the rest of the map (workspaceFolders) unchanged.java-analyzer-bundle.test/docs/integration-tests.md (1)
482-482: Add language specifier to fenced code block.The fenced code block lacks a language specifier. Since this shows test output, use
textorplaintextfor proper markdown rendering.📝 Proposed fix
-``` +=== RUN TestDefaultSearch +```text +=== RUN TestDefaultSearch🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@java-analyzer-bundle.test/docs/integration-tests.md` at line 482, The fenced code block that contains the test output for "TestDefaultSearch" is missing a language specifier; update the triple-backtick fence surrounding the block that starts with "=== RUN TestDefaultSearch" to use a plaintext/text specifier (e.g., change ``` to ```text) so the test output renders correctly in markdown.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/post-release-bump.yaml:
- Around line 40-52: The translate_version function in this workflow is
inconsistent with the one in image-build.yaml and lacks pre-release suffix
handling; extract the logic into a shared shell script (e.g.,
scripts/translate_version.sh) that implements the same transformation as
image-build.yaml including detection and preservation of pre-release suffixes
(like -rc.1, -alpha.2) and the numeric translation rules, then replace the
inline translate_version definitions in both workflows with sourcing of that
script and calling the shared translate_version function to ensure consistent
behavior and single-point maintenance.
In `@java-analyzer-bundle.test/docs/integration-tests.md`:
- Line 482: The fenced code block that contains the test output for
"TestDefaultSearch" is missing a language specifier; update the triple-backtick
fence surrounding the block that starts with "=== RUN TestDefaultSearch" to
use a plaintext/text specifier (e.g., change ``` to ```text) so the test output
renders correctly in markdown.
In `@java-analyzer-bundle.test/integration/client/jdtls_client.go`:
- Around line 191-194: The bundles path is hardcoded as "/jdtls/plugins" but
JDTLSClient already holds the installation path in jdtlsPath; update the call to
findAnalyzerBundles inside the InitializationOptions map to derive the plugins
directory from the client's jdtlsPath (e.g., use filepath.Join(jdtlsPath,
"plugins") or path.Join depending on imports) instead of the literal string,
ensuring you reference the JDTLSClient receiver/field (jdtlsPath) and keep the
rest of the map (workspaceFolders) unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: a4a16225-6138-4ba6-8bd5-ad9ad31318ed
📒 Files selected for processing (15)
.github/workflows/image-build.yaml.github/workflows/post-release-bump.yamlDockerfileDockerfile.testMakefilejava-analyzer-bundle.core/META-INF/MANIFEST.MFjava-analyzer-bundle.core/pom.xmljava-analyzer-bundle.site/pom.xmljava-analyzer-bundle.test/META-INF/MANIFEST.MFjava-analyzer-bundle.test/README.mdjava-analyzer-bundle.test/docs/integration-tests.mdjava-analyzer-bundle.test/integration/client/jdtls_client.gojava-analyzer-bundle.test/pom.xmljava-analyzer-bundle.tp/pom.xmlpom.xml
✅ Files skipped from review due to trivial changes (8)
- java-analyzer-bundle.core/META-INF/MANIFEST.MF
- pom.xml
- java-analyzer-bundle.test/META-INF/MANIFEST.MF
- java-analyzer-bundle.core/pom.xml
- java-analyzer-bundle.tp/pom.xml
- java-analyzer-bundle.test/pom.xml
- java-analyzer-bundle.site/pom.xml
- java-analyzer-bundle.test/README.md
🚧 Files skipped from review as they are similar to previous changes (3)
- Dockerfile
- Dockerfile.test
- Makefile
This should enable Tag v0.9.2 -> 1.0.1 release of the artifact.
fixes #59
Because we already have 1.0.0 release downstream, this was the best that
I could think of to try and map downstream build to the released build
downstream using the actual artifact.
Summary by CodeRabbit
Chores
CI/CD
Tests
Documentation